﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate.Mappings;

namespace Apollo.Modules.Sales
{
    [NHibernateEntity(Table = "Activities")]
    public class Activity : ITrackable, IOwnable
    {
        public Activity() { }

        [PrimaryKey]
        public virtual int Id { get; set; }

        [Property]
        public virtual string Name { get; set; }

        [Property(Length=10000)]
        public virtual string Description { get; set; }

        [Property(Length = 10000)]
        public virtual string ContactInfo { get; set; }

        [Property]
        public virtual DateTime ActivityDate { get; set; }

        [Property]
        public virtual State State { get; set; }

        [Property]
        public virtual ActivityType Type { get; set; }

        [BelongsTo(Column = "ID_Owner_Employee")]
        public virtual Employee Owner { get; set; }
        
        [BelongsTo(Column = "ID_OpportunityClosingReason")]
        public virtual OpportunityClosingReason ClosingReason { get; set; }
        


        [BelongsTo(Column = "ID_Campaign")]
        public virtual Campaign Campaign { get; set; }
        
        [BelongsTo(Column = "ID_Contract")]
        public virtual Contract Contract { get; set; }

        [BelongsTo(Column = "ID_Account")]
        public virtual Account Account { get; set; }

        [BelongsTo(Column = "ID_Opportunity")]
        public virtual Opportunity Opportunity { get; set; }



        [BelongsTo(Column = "ID_Parent_Activity")]
        public virtual Activity Parent { get; set; }

        [Property]
        public virtual DateTime InsertDate { get; set; }

        [Property]
        public virtual string InsertBy { get; set; }

        [Property]
        public virtual DateTime? ModifiedDate { get; set; }

        [Property]
        public virtual string ModifiedBy { get; set; }




        #region Next activty

        [Property]
        public virtual DateTime NextActivityDate { get; set; }

        [Property]
        public virtual ActivityType NextActivityType { get; set; }

        [BelongsTo(Column = "ID_Owner_Employee")]
        public virtual Employee NextActivityOwner { get; set; }

        #endregion
    }

    public enum ActivityType { 
        None = 0,
        Phone = 1,
        Email = 2,
        Meeting = 3,
        Event = 4
    }
}
